import type { GoodsResult } from '@/types/goods'
import { http } from '@/utils/http'

/**
 * 商品详情(线路详情)
 * @param id 商品id
 */
// 列表
// export const getDailyScheduleByTourId = (data:{page:number,pageSize:number}) => {
//   return http<GoodsResult>({
//     method: 'GET',
//     url: '/tour/tour/route/getTourRouterList',
//     data,
//   })
// }
// 商品--计划总览--根据行程id获取每日信息
export const getDailyScheduleByTourId = (data: { tourId: any }) => {
  return http({
    method: 'GET',
    url: '/tour/tour/dailySchedule/getDailyScheduleByTourId',
    data,
  })
}

// 商品--根据每日行程id获取每日信息详情
export const getDailyScheduleDetail = (data: { dailyScheduleId: number }) => {
  return http({
    method: 'GET',
    url: '/tour/tour/dailySchedule/getDailyScheduleDetail',
    data,
  })
}

/**
 * 添加旅客信息
 * @param data 请求参数
 */
export const addOrUpdateTraveler = (data: any) => {
  return http({
    method: 'POST',
    url: '/tour/tour/traveler/addOrUpdateTraveler',
    data,
  })
}

/**
 * 获取旅客信息列表
 */
export const getTravelerList = () => {
  return http({
    method: 'GET',
    url: '/tour/tour/traveler/getTravelerList',
  })
}
/**
 * 删除旅行者信息
 */
export const deleteTraveler = (id: number) => {
  return http({
    method: 'POST',
    url: '/tour/tour/traveler/deleteTraveler',
    header: {
      'content-type': 'application/x-www-form-urlencoded', // 设置请求头
    },
    data: {
      id,
    },
  })
}

/**
 * 商品下单详情
 */
export const getTourRouteDetail = (id: any) => {
  return http({
    method: 'GET',
    url: '/tour/tour/route/getTourRouteDetail',
    data: {
      id,
    },
  })
}

/**
 * 获取收货地址详情
 * @param id 地址id(路径参数)
 */
export const getMemberAddressByIdAPI = (id: string) => {
  return http({
    method: 'GET',
    url: `/member/address/${id}`,
  })
}

/**
 * 修改收货地址
 * @param id 地址id(路径参数)
 * @param data 表单数据(请求体参数)
 */
export const putMemberAddressByIdAPI = (id: string, data: AddressParams) => {
  return http({
    method: 'PUT',
    url: `/member/address/${id}`,
    data,
  })
}

/**
 * 删除收货地址
 * @param id 地址id(路径参数)
 */
export const deleteMemberAddressByIdAPI = (id: string) => {
  return http({
    method: 'DELETE',
    url: `/member/address/${id}`,
  })
}
